package com.wy.authority.service.impl;

import org.springframework.stereotype.Service;

/**
 * @Author 忘忧
 * @Date Created in 2021/1/15 16:02
 * @Description:
 */
@Service
public class UserDetailsServiceImpl  {
//    implements UserDetailsService
//    @Autowired
//    private UserMapper userMapper;
//    @Autowired
//    PasswordEncoder passwordEncoder;
//
//    @Override
//    public UserDetails loadUserByUsername(String user_name) throws UsernameNotFoundException {
//        sysUser sysuser = userMapper.getUser(user_name);
//        if (sysuser == null){
//            return null;
//        }else{
//            Collection<GrantedAuthority> authorities = new ArrayList<>();
//            authorities.add(new SimpleGrantedAuthority("ROLE_ADMIN"));
//            User user = new User(sysuser.getUser_name(),passwordEncoder.encode(sysuser.getPassword()),authorities);
//           System.out.println("管理员信息："+user.getUsername()+"   "+passwordEncoder.encode(sysuser.getPassword())+"  "+user.getAuthorities());
//            return user;
//        }
//
//    }
//
//    @Bean
//    public PasswordEncoder passwordEncoder(){
//        return new BCryptPasswordEncoder();
//    }
}
